Skip to content

fix(view): contain the resolved view path to the views root - #7520

Closed
arcgod-design wants to merge 1 commit into
expressjs:masterfrom
arcgod-design:feat/issue-7140-view-prototype-lookup-lacks-path-contain
Closed

arcgod-design wants to merge 1 commit into
expressjs:masterfrom
arcgod-design:feat/issue-7140-view-prototype-lookup-lacks-path-contain

Conversation

@arcgod-design

Copy link
Copy Markdown

What

Adds a path-containment check to View.prototype.lookup() so a resolved view path must stay inside the configured views directory, mirroring the root containment res.sendFile() gets from the send library.

Why

lookup() used path.resolve(root, name) without validating the result stays within root. Combined with decodeURIComponent() in route parameter decoding, applications that pass user input to res.render() are exposed to path traversal (issue #7140).

How

After resolving, the resolved path is checked against resolve(root) + path.sep; views outside the root are skipped by the existing iteration.

closes #7140

View.prototype.lookup resolved paths without checking that the result stays inside the configured views directory, allowing path traversal through user-supplied view names (mirrors the containment check the send library applies for res.sendFile).

closes expressjs#7140
Copilot AI balanced review requested due to automatic review settings October 11, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

arcgod-design pushed a commit to arcgod-design/gitswipe that referenced this pull request Oct 11, 2026
…ch detection, automated PR creation

THE REAL PR LANDED: expressjs/express#7520 - the
full loop on a real major OSS repo: swipe -> nemotron analysis -> task
contract -> worktree -> the fix -> fork -> push -> PR, closes #7140.

The gh wiring (user directive: 'include this as github cli check and
logged in and etc and allow gitswipe harness to use it properly'):
- checkGitHubCli(): installed + version + logged-in account; reported in
  the serve banner and used at dispatch (the honest fallback chain when
  gh is absent: API -> compare-URL handoff)
- forkRepository(): 'gh repo fork <o>/<r> --clone=false' when logged in
- defaultBranchOf(): via 'gh api repos/<r> --jq default_branch' - the
  express PR failed on 'main' because the default branch is MASTER; the
  contract's base_branch + pr_base_branch now derive from the repo's
  ACTUAL default, never a hardcoded guess
- createPullRequestViaCli(): 'gh pr create' with the fallback detail;
  the adapter's approved-push path now creates the PR automatically
  (thinking-summary 'creating the pull request...' + the completed
  summary carries the PR URL; gh-absent -> the compare-URL line)
- The dispatch path sets forkOwner on the adapter (from the gh login) +
  configures remotes: origin = the fork, upstream = the target
- 191/191 tests, typecheck clean
@krzysdz

krzysdz commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Duplicate of #7142

@krzysdz krzysdz marked this as a duplicate of #7142 Oct 11, 2026
@krzysdz krzysdz closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

View.prototype.lookup() lacks path containment check (unlike send library for res.sendFile)

3 participants